// 积分秒杀管理相关API
import request from '../utils/request'

// 获取秒杀商品列表
export const getSeckillProductList = (params) => {
  return request({
    url: '/api/seckill/products',
    method: 'get',
    params
  })
}

// 获取秒杀商品详情
export const getSeckillProductDetail = (id) => {
  return request({
    url: `/api/seckill/products/${id}`,
    method: 'get'
  })
}

// 创建秒杀商品
export const createSeckillProduct = (data) => {
  return request({
    url: '/api/seckill/products',
    method: 'post',
    data
  })
}

// 更新秒杀商品
export const updateSeckillProduct = (id, data) => {
  return request({
    url: `/api/seckill/products/${id}`,
    method: 'put',
    data
  })
}

// 删除秒杀商品
export const deleteSeckillProduct = (id) => {
  return request({
    url: `/api/seckill/products/${id}`,
    method: 'delete'
  })
}

// 开始秒杀活动
export const startSeckillActivity = (id) => {
  return request({
    url: `/api/seckill/products/${id}/start`,
    method: 'post'
  })
}

// 结束秒杀活动
export const endSeckillActivity = (id) => {
  return request({
    url: `/api/seckill/products/${id}/end`,
    method: 'post'
  })
}

// 获取可选择的商品列表
export const getAvailableProducts = (params) => {
  return request({
    url: '/api/seckill/available-products',
    method: 'get',
    params
  })
}